package com.example.demo.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.example.demo.dao.UserMapper;
import com.example.demo.entity.User;
import com.example.demo.service.IUserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hanfei
 * @since 2020-04-08
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
        @Resource
        public UserMapper mapper;

        public UserMapper getMapper() {
        return mapper;
        }

        public void setMapper(UserMapper mapper) {
        this.mapper = mapper;
        }

        public Page<User> findByKey(Page<User> var1, @Param("key") String key){
        var1.setRecords(mapper.findByKey(var1,key));
        return var1;
        }
        public Page<User> findByKeyAndAll(Page<User> var1, @Param("key") String key, User entity){
        var1.setRecords(mapper.findByKeyAndAll(var1,key,entity));
        return var1;
        }
        public User findByUsername(String username){
                return mapper.findByUsername(username);
        }
        public User login(@Param("username")String username, @Param("password") String password){
                return mapper.login(username, password);
        }

        }
